﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>添加日志</title>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/kindeditor/kindeditor-min.js"></script>
		<script type="text/javascript" src="js/kindeditor/lang/zh_CN.js"></script>
		<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
		<script type="text/javascript">
var editor;
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="content"]', {
		resizeType : 1,
		allowPreviewEmoticons : false,
		allowImageUpload : false,
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'image', 'link']
	});
	});

	function addtext(){
		var id = $("#ids").val();
		var createTime = $("#createTime").val();
		var weather = $("#weather").val();
		var content = editor.html();
		if($.trim(createTime)==''||$.trim(createTime)=='null'){
			$("#errorinfo").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">日期不能为空！</font>");
			return;
		}else{
			$("#errorinfo").html("");
		}
		if($.trim(content)==''||$.trim(content)=='null'){
			$("#errorinfo").html("<img src=\"image/cuo.gif\" width=\"16\" height=\"16\" />&nbsp;<font color=\"#FF0000\">内容不能为空！</font>");
			return;
		}else{
			$("#errorinfo").html("");
		}
		if(content.length>2000){
		   alert("不能超过2000个字符");
		   return;
		}
		var param={"content":content,"createTime":createTime,"weather":weather,"id":id};
		$.post("updateDalily.action",param,function(data){
			if(data=='success'){
			    alert("修改成功");
				window.close();
				var currentPage=$("#currentPage").val();
					window.opener.page(currentPage);
			}else{
				alert("添加失败！");
			}
		});
	}
</script>
	</head>
	<body>
	<input type="hidden" id="currentPage" value="${currentPage}">
	<input id="ids" type="hidden" value="${oDaily.id}" />
		<table align="center" border="0" cellpadding="0" cellspacing="0" width="90%">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
        <td>个人办公 &gt; 我的办公桌 &gt; 日志 &gt;修改</td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>
		<table align="center">
		<tr>
			<td>
			日期：&nbsp;<input id="createTime" name="createTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<fmt:formatDate value="${oDaily.createTime}"
				pattern="yyyy-MM-dd" />" class="Wdate" type="text" readonly="readonly" />
			</td>
			<td align="right">天气：${oDaily.weather}<input type="hidden" id="weather" value="${oDaily.weather}">
			</td>
		</tr>
			<tr>
				<td colspan="2">
					<textarea name="content" id="content" style="width: 450px; height: 300px; visibility: hidden;">${oDaily.content}</textarea>
				</td>
			</tr>
		</table>
		<table align="center">
		<tr>
		<td><span id="errorinfo"></span></td>
		</tr>
		<tr>
		<td>
			<input type="button" class="button_02" value="保存" onclick="addtext()" />
			<input type="button" class="button_02" value="关闭" onclick="window.close();" />
		</td>
			</tr>
		</table>
</td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
	</body>
</html>